USE [AnotherSuccessfulProcedure]

IF EXISTS (SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[FlagEventSelectCountByPlayerIdLogId]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
BEGIN
	DROP PROCEDURE dbo.FlagEventSelectCountByPlayerIdLogId
END


SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		Neil Wilson
-- Create date: 09/03/08
-- Description:	FlagEvent Table Select Count By PlayerId and LogId
-- =============================================
CREATE PROCEDURE FlagEventSelectCountByPlayerIdLogId

            @LogId int,
			@PlayerId varchar(30),
			@FlagEventType varchar(30),
			@FlagEventCount int = 0 OUTPUT
	
AS

BEGIN

select @FlagEventCount = COUNT(FlagId) FROM Flag 
		WHERE LogId = @LogId
		AND PlayerId = @PlayerId
		AND FlagEventId = (SELECT FlagEventId FROM FlagEventType WHERE FlagEventShortName = @FlagEventType)


END
GO


